<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
 

class tbdata_queue_productgets{

    function run(&$cursor_id,$params){
          //每次最多处理1个子分类
        $model = app::get('tbdata')->model('cats');
		$sync = kernel::single('tbdata_sync');
        $db = kernel::database();
		$filter = $params['filter'];
		$cid = $filter['cid'];

		$rows = $model->getList('*',array('cid'=>$cid,'products_download_time|sthan'=>$params['queue_time']),0,1);
		if($rows[0]){
			$cid = $rows[0]['cid'];
			$sync->get_products($cid);
			$model->update(array('products_download_time'=>time()),array('cid'=>$cid));
			return 1;
		}else{
			return 0;
		}
    }
}
